﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;

namespace MyBasicLib.Data.ORMLiteNew
{
    public enum DbExpressionType
    {
        None,
        GetTable,
        All,
        Any,
        Average,
        Count,
        DefaultIfEmpty,
        Distinct,
        First,
        FirstOrDefault,
        GroupBy,
        GroupJoin,
        Join,
        Max,
        Min,
        OrderBy,
        OrderByDescending,
        Select,
        SelectMany,
        Single,
        SingleOrDefault,
        Skip,
        Sum,
        Take,
        ThenBy,
        ThenByDescending,
        Where,
        Union,
        Insert,
        Delete,
        Update
    }
    public class DbExpression
    {
        public DbExpression(DbExpressionType dbExpressionType)
            : this(dbExpressionType, null)
        {

        }
        public DbExpression(DbExpressionType dbExpressionType, Expression expression)
        {
            DbExpressionType = dbExpressionType;
            Expression = expression;
        }
        public DbExpressionType DbExpressionType { get; set; }
        public Expression[] Expressions { get; set; }
        public Expression Expression { get; set; }
    }


    public interface IDbQueryable
    {
        IDbQueryProvider Provider { get; set; }
        IList<DbExpression> DbExpressionList { get; set; }

    }
    public interface IDbQueryable<TElement> : IDbQueryable //: System.Linq.IQueryable<TSource>
    {
        //TElement Execute();

        //List<TElement> ExecuteList();

        Func<T> Compily<T>();
    }
}
